<template>
  <div class="performance-title"></div>
  <div class="navbox">
    <div class="item" :class="navStatus === 1 ? 'chose' : ''" @click="navStatus = 1">治理质效“一图览”</div>
    <div class="item" :class="navStatus === 2 ? 'chose' : ''" @click="navStatus = 2">报告列表</div>
  </div>
  <!-- 治理质效“一图览” -->
  <div class="reviewechartbox" v-show="navStatus === 1">
    <div class="echarttitle">
      <div class="item">
        <div class="yuan1"></div>
        <div class="text">一月</div>
      </div>
      <div class="item">
        <div class="yuan2"></div>
        <div class="text">二月</div>
      </div>
      <div class="item">
        <div class="yuan3"></div>
        <div class="text">三月</div>
      </div>
    </div>
    <e-charts id="leida" ref="leida" :option="leidaData"></e-charts>
  </div>
  <!-- 报告列表 -->
  <div class="baogaobox" v-show="navStatus === 2">
    <div class="item" v-for="item in list" :key="item.type">
      <div class="left">
        <div class="a" :class="item.type==1?'color1':item.type==2?'color2':item.type==3?'color3':''">{{item.name1}}</div>
        <div class="b">{{item.name2}}</div>
      </div>
      <div class="right">{{item.name3}}</div>
    </div>
  </div>
</template>

<script setup lang="ts">
import * as echarts from 'echarts';
import { onMounted, ref } from 'vue';

let navStatus = ref(1)

// 配置项
let leidaData = ref({});
// 初始化echarts
function initEcharts() {
  leidaData.value = {
    tooltip: {
      trigger: 'axis',
      backgroundColor: '#0A3783',
      textStyle: {
        color: 'white',
      },
    },
    radar: {
      indicator: [
        { name: '噪声污染改善' },
        { name: '居民满意度' },
        { name: '投诉举报量' },
        { name: '违规整改完成情况' },
        { name: '消防安全达标' },
      ]
    },
    series: [
      {
        name: 'Budget vs spending',
        type: 'radar',
        data: [
          {
            value: [600, 500, 400, 300, 100],
            name: '一月',
            tooltip: {
              trigger: 'item'
            },
            areaStyle: {
              color: new echarts.graphic.RadialGradient(0.1, 0.6, 1, [
                {
                  color: 'rgba(0, 213, 255, 0.1)',
                  offset: 0
                },
                {
                  color: 'rgba(0, 213, 255, 0.9)',
                  offset: 1
                }
              ])
            }
          },
          {
            value: [100, 200, 300, 400, 500],
            name: '二月',
            tooltip: {
              trigger: 'item'
            },
            areaStyle: {
              color: new echarts.graphic.RadialGradient(0.1, 0.6, 1, [
                {
                  color: 'rgba(42, 156, 255, 0.1)',
                  offset: 0
                },
                {
                  color: 'rgba(42, 156, 255, 0.9)',
                  offset: 1
                }
              ])
            }
          },
          {
            value: [600, 200, 600, 500, 100],
            name: '三月',
            tooltip: {
              trigger: 'item'
            },
            areaStyle: {
              color: new echarts.graphic.RadialGradient(0.1, 0.6, 1, [
                {
                  color: 'rgba(235, 205, 60, 0.1)',
                  offset: 0
                },
                {
                  color: 'rgba(235, 205, 60, 0.9)',
                  offset: 1
                }
              ])
            }
          },
        ]
      }
    ]
  }
}
onMounted(() => {
  initEcharts();
});

let list = ref([
  {name1:'典型案例',name2:'经营风险：2025年1月小龙坎街道处置无证经营案例',name3:'2025-2-23',type:2},
  {name1:'典型案例',name2:'聚众赌博：2025年1月处置聚众赌博案例',name3:'2025-1-25',type:2},
  {name1:'建议文档',name2:'如何处置群众投诉的办法建议',name3:'2025-1-01',type:1},
  {name1:'复盘报告',name2:'2024年四季度复盘报告',name3:'2024-12-24',type:3},
  {name1:'复盘报告',name2:'2024年12月复盘报告',name3:'2024-12-24',type:3},
  {name1:'复盘报告',name2:'2024年11月复盘报告',name3:'2024-12-24',type:3},
  {name1:'典型案例',name2:'经营风险：2025年1月小龙坎街道处置无证经营案例',name3:'2025-2-23',type:2},
  {name1:'典型案例',name2:'聚众赌博：2025年1月处置聚众赌博案例',name3:'2025-1-25',type:2},
  {name1:'建议文档',name2:'如何处置群众投诉的办法建议',name3:'2025-1-01',type:1},
  {name1:'复盘报告',name2:'2024年四季度复盘报告',name3:'2024-12-24',type:3},
  {name1:'复盘报告',name2:'2024年12月复盘报告',name3:'2024-12-24',type:3},
  {name1:'复盘报告',name2:'2024年11月复盘报告',name3:'2024-12-24',type:3},
])
</script>

<style lang="less" scoped>
.performance-title {
  width: 100%;
  height: 44px;
  margin: 15px 0 12px 0;
  background-image: url("../../../assets/mahjong/icon42.png");
  background-size: 100% 100%;
}

.navbox {
  width: 100%;
  display: flex;
  justify-content: space-between;

  .item {
    width: 267px;
    height: 32px;
    background-image: url("../../../assets/mahjong/icon43.png");
    background-size: 100% 100%;
    font-size: 14px;
    color: rgba(255, 255, 255, .7);
    cursor: pointer;
    line-height: 32px;
    text-align: center;
  }

  .chose {
    background-image: url("../../../assets/mahjong/icon44.png") !important;
    color: white !important;
  }
}

.reviewechartbox {
  width: 100%;
  height: 320px;
  margin-top: 25px;
  position: relative;

  .echarttitle {
    display: flex;
    align-items: center;
    position: absolute;
    left: 0;
    top: 0;

    .item {
      width: 61px;
      height: 20px;
      background: #d8f0ff14;
      margin-right: 5px;
      display: flex;
      justify-content: center;
      align-items: center;

      .yuan1 {
        width: 6px;
        height: 6px;
        background: #00D5FF;
        border-radius: 50%;
      }

      .yuan2 {
        width: 6px;
        height: 6px;
        background: #2A9CFF;
        border-radius: 50%;
      }

      .yuan3 {
        width: 6px;
        height: 6px;
        background: #EBCD3C;
        border-radius: 50%;
      }

      .text {
        font-size: 10px;
        color: #d8f0ffcc;
        margin-left: 5px;
      }
    }
  }

  #leida {
    widows: 700px;
    height: 320px;
  }
}
/* 隐藏滚动条轨道 */
.baogaobox::-webkit-scrollbar {
  display: none; /* 对于Chrome和Safari */
}
.baogaobox {
  width: 100%;
  height: 330px;
  margin-top: 15px;
  overflow-y: scroll;

.item:nth-child(odd){
      background: rgba(71, 138, 138, 0);
      box-shadow: inset 0 -1px 0 0 rgba(108, 128, 151, 0.5);
  }
  .item:nth-child(even){
      background: rgba(71, 107, 138, 0.1);
      box-shadow: inset 0 -1px 0 0 rgba(108, 128, 151, 0.5);
  }
  .item {
    width: 100%;
    height: 44px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;

    .left {
      flex: 1;
      display: flex;
      align-items: center;

      .a {
        width: 60px;
        height: 20px;
        border-radius: 2px;
        line-height: 20px;
        text-align: center;
        font-size: 12px;
        color: #FFFFFF;
      }

      .color1 {
        background: #1F9C5B;
      }

      .color2 {
        background: #DBA519;
      }

      .color3 {
        background: #1398FF;
      }

      .b {
        font-size: 12px;
        color: #FFFFFF;
        margin-left: 12px;
      }
    }

    .right {
      width: 80px;
      font-size: 12px;
      color: #FFFFFF;
    }
  }
}
</style>
